﻿using System;

using BizElements.Web;
using BizElements.Web.UI;

namespace MySolution.Web
{
    public partial class Toolbar : System.Web.UI.Page
    {
        /// <summary>Tries to initialize Page.UICulture to match culture defined in UserSession.UiCulture.</summary>
        protected override void InitializeCulture()
        {
            if (UserSession.UiCulture != null)
                this.UICulture = UserSession.UiCulture.Name;
        }

        /// <summary>Displays user data.</summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DisplayUser();
            }
        }

        /// <summary>NOT IMPLEMENTED - add your sign-out implementation here.</summary>
        protected void uiLogoutBtn_Click(object sender, object e)
        {
            //AccountController.SignOut(/*in frameset*/ true);
        }

        /// <summary>Tries to dispaly user data.</summary>
        private void DisplayUser()
        {
            if (UserSession.Actor != null && UserSession.Actor.ExtendedProperties != null)
                this.uiCurrentUserLbl.Text = UserSession.Actor.ExtendedProperties["FullName"];
        }
    }
}
